package it.thalaz.business;


import it.thalaz.business.manager.UtentiManager;
import it.thalaz.common.exception.GenericException;
import it.thalaz.dataaccess.dto.Utenti;
import it.thalaz.dataaccess.dto.UtentiExample;

import java.sql.SQLException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class BusinessDelegate {

	private static final Log LOG = LogFactory.getLog(BusinessDelegate.class);

	private BusinessDelegate() {
		super();
	}

	private static BusinessDelegate instance = null;

	public static BusinessDelegate getInstance() {
		if (instance == null)
			instance = new BusinessDelegate();
		return instance;
	}

	/**
	 * Create a new record into 'dvelcms.cms_link' table in Database.
	 * @param bean   The Utenti to be inserted.
	 * @return Utenti Object inserted.
	 * @exception    SQLException if something is wrong.
	 * @exception    GenericException if something is wrong.
	 */
	public synchronized final void create(Utenti bean) throws GenericException {
		UtentiManager.create(bean);
	}

	/**
	 * Retrive a record from 'dvelcms.cms_link' table of Database.
	 * @param key       The PK Object to be retrived.
	 * @exception       SQLException if something is wrong.
	 * @exception       GenericException if there is no record returned.
	 */
	public synchronized final Utenti get(Utenti key) throws GenericException {
		return UtentiManager.get(key);
	}

	/**
	 * Retrive all the Utenti objects from Database.
	 * @param iddocumento   The Documento Id.
	 * @exception           SQLException if something is wrong.
	 * @exception           GenericException if there is no record returned.
	 */
	public synchronized final Utenti[] getAllUtenti(UtentiExample bean) throws GenericException {
		return UtentiManager.getAllUtenti(bean);
	}

	/**
	 * Update a record into 'dvelcms.cms_link' table of Database.
	 * @param bean   The Object to be saved.
	 * @exception    SQLException if something is wrong.
	 * @exception    GenericException if something is wrong.
	 */
	public synchronized final void update(Utenti bean) throws GenericException {
		UtentiManager.update(bean);
	}

	/**
	 * Delete a record from 'dvelcms.cms_link' table of Database.
	 * @param key    The PK Object to be deleted.
	 * @exception    SQLException if something is wrong.
	 * @exception    GenericException if something is wrong.
	 */
	public synchronized final void delete(Utenti key) throws GenericException {
		UtentiManager.delete(key);
	}

	
}
